/**
 * @PROJECT 
 * @DATE 2018年7月22日 下午12:44:13
 * @AUTHOR LUYU
 */
package com.kool.evowkf.action.approve;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.kool.core.base.IBaseAction;
import com.kool.core.exception.AppException;
import com.kool.evowkf.bean.io.approve.CMAGENTXBean;
import com.kool.evowkf.service.ApproveService;

/**
 * @DESCRIBE 取消代理
 * @AUTHOR LUYU
 * @DATE 2018年7月22日 下午12:44:13
 *
 */
@Controller
public class CancelAgentAction implements IBaseAction {
	@Autowired
	private ApproveService service;

	@Override
	@ResponseBody
	@RequestMapping(value = "/comm/wkf/cancelAgent", method = RequestMethod.POST)
	public JSONObject doAction(@RequestBody String sInput) throws AppException {
		JSONObject pkgIn = JSONObject.parseObject(sInput);
		JSONArray secIn = pkgIn.getJSONArray("CMAGENTX");
		JSONObject propIn = secIn.getJSONObject(0);
		CMAGENTXBean ioIn = JSON.toJavaObject(propIn, CMAGENTXBean.class);
		String nodeCid = ioIn.getNodeCid();

		service.cancelAgent(nodeCid);

		return null;
	}

}
